package com.jeesite.modules.kj.api.vo.response;

import com.jeesite.modules.kj.api.vo.response.base.BaseResponseVo;
import com.jeesite.modules.kj.entity.KjActivityComment;
import com.jeesite.modules.kj.entity.KjActivityJob;
import com.jeesite.modules.kj.utils.LikesUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class ActivityCommentResponseVo extends BaseResponseVo<KjActivityComment> {

    @ApiModelProperty(value = "ID")
    private String id;

    @ApiModelProperty(value = "评论内容")
    private String content;

    @ApiModelProperty(value = "回复")
    private String reply;

    @ApiModelProperty(value = "评论人")
    private String memberName;
    @ApiModelProperty(value = "评论人ID")
    private String memberId;

    @ApiModelProperty(value = "头像")
    private String headImg;

    @ApiModelProperty(value = "评论时间")
    private Date commentTime;


    @ApiModelProperty(value = "点赞数")
    private long likes;



    @ApiModelProperty(value = "是否点赞")
    private String isLike;

    public ActivityCommentResponseVo() {
    }

    public ActivityCommentResponseVo(KjActivityComment activityComment) {
        setEntity(activityComment);
    }

    @Override
    public void setEntity(KjActivityComment entity) {
        BeanUtils.copyProperties(entity, this);
        this.likes = LikesUtil.getLikesCount(entity.getId());
        this.isLike = "0";
        if(entity.getKjMember() != null) {
            this.headImg = entity.getKjMember().getHeadimg();
            this.memberName = entity.getKjMember().getName();
            this.memberId = entity.getKjMember().getId();
        }
    }
}
